$7gh + 9gi + g + 1 = 9h + 5$ Solve for $g$.
Combine constant terms on the right. $7gh + 9gi + g + {1} = 9h + {5}$ $7gh + 9gi + g = 9h + {4}$ Notice that all the terms on the left-hand side of the equation have $g$ in them. $7{g}h + 9{g}i + 1{g} = 9h + 4$ Factor out the $g$ ${g} \cdot \left( 7h + 9i + 1 \right) = 9h + 4$ Isolate the $g$ $g \cdot \left( {7h + 9i + 1} \right) = 9h + 4$ $g = \dfrac{ 9h + 4 }{ {7h + 9i + 1} }$